home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bchelp10.zip / TI653.ASC < prev    next >
Text File  |  1991-09-17  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Borland C                              NUMBER  :  653
  9.   VERSION  :  All
  10.        OS  :  PC DOS
  11.      DATE  :  September 17, 1991                       PAGE  :  1/2
  12.  
  13.     TITLE  :  Abbreviated DLL Generation Procedure
  14.  
  15.  
  16.  
  17.  
  18.   Below  is  all  the  code  and information necessary to create  a
  19.   Dynamic Link Library file using Borland C++ 2.0  for  Windows. It
  20.   includes a sample C source file as well as the  module definition
  21.   file  (.DEF).    Instructions on how to configure Borland C++ 2.0
  22.   and compile the C source code is also listed below.   Please note
  23.   this  is  the  bare minimum amount of code needed to create a DLL
  24.   file  and will actually do nothing if loaded  by  a  Windows  EXE
  25.   file.
  26.  
  27.   //...............................................................
  28.   // DLLTEST.C -- notice we have a LIBMAIN function instead of
  29.                   WINMAIN
  30.  
  31.   #include <windows.h>  // Include the Windows function prototypes
  32.  
  33.   int FAR PASCAL LibMain(HANDLE hInstance, WORD wDataSeg,
  34.                          WORD wHeapSize, LPSTR lpszCmdLine)
  35.   {
  36.       // Any code that needs to be executed only once when the
  37.       // DLL gets loaded by Windows goes here.
  38.  
  39.       return 1;               // Success (or 0 for Failure)
  40.   }
  41.  
  42.   int FAR PASCAL WEP(int nParameter)
  43.   {
  44.       return 1;
  45.   }
  46.  
  47.   //...............................................................
  48.   // DLLTEST.DEF -- notice we have a LIBRARY  statement  instead of
  49.   //                  EXETYPE as well as a DATA statement ending in
  50.   //                the word SINGLE.
  51.  
  52.   LIBRARY     DLLTEST
  53.   DESCRIPTION 'How to create a Dynamic Link Library'
  54.   CODE        PRELOAD MOVEABLE DISCARDABLE
  55.   DATA        PRELOAD MOVEABLE SINGLE
  56.   EXPORTS
  57.       LibMain             @1
  58.       WEP                 @2
  59.  
  60.   //...............................................................
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Borland C                              NUMBER  :  653
  75.   VERSION  :  All
  76.        OS  :  PC DOS
  77.      DATE  :  September 17, 1991                       PAGE  :  2/2
  78.  
  79.     TITLE  :  Abbreviated DLL Generation Procedure
  80.  
  81.  
  82.  
  83.  
  84.   To compile the test .DLL file type:
  85.       BCC -WD dlltest.c  <enter>
  86.  
  87.   //................................................................
  88.  
  89.   Make sure that  Borland  C++  2.0  is  in your path prior to both
  90.   Microsoft C and any earlier version of Turbo C++.
  91.  
  92.     Example: path=c:\dos;c:\borlandc\bin;c:\xtgold;c:\tc\bin
  93.  
  94.   //................................................................
  95.  
  96.   Make sure the TURBOC.CFG file being used has the correct  path to
  97.   both library and include files.
  98.  
  99.       Example:
  100.           -Ic:\borlandc\include
  101.           -Lc:\borlandc\lib
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.